package es.deusto.engineering.is.kbs.snakes;

import java.util.ArrayList;
import java.util.List;

public class Snake {

	public static enum Fangs{
		FRONT_MOVABLE,
		FRONT_FIXED,
		REAR
	}
	
	public static enum BodyShape {
		STOUT,
		SLENDER
	}
	
	public static enum LengthRange {
		SMALL,
		MEDIUM,
		LARGE
	}

	public static enum Color {
		BROWN,
		LIGHT_BROWN,
		GREEN
	}
	
	public static enum Pattern {
		DIAMOND_SHAPED_BROWN_BLOTCHES,
		HEXAGON_SHAPED_PALE_BLOTCHES,
		RED_YELLOW_BLACK_BANDS,
		DARK_BROWN_BANDS,
		UNIFORM_COLOR
	}

	public static enum Scales {
		SMOOTH,
		KEELED
	}

	public static enum Feature {
		BIG_ROUND_PUPILS,
		PROTUBERANT_HEAD_NOSTRILS,
		TAIL_RATTLE
	}
	
	public static enum Name {
		GABBON_VIPER,
		RHINOCEROS_VIPER,
		COPPER_HEAD_SNAKE,
		RATTLE_SNAKE,
		CORAL_SNAKE,
		BOOMSLANG		
	}
	
	public static enum Check {	
		FANGS,
		PITS,
		PATTERN_AND_COLOR,
		SCALES,
		RATTLE,
		LENGTH,
		SHAPE
	}
	
	private String identifier;
	private Fangs fangs;
	private Boolean pit;
	private Color color;
	private Pattern pattern;
	private Scales scales;
	private List<Feature> features;
	private Double length;
	private Double circumference;
	private LengthRange lengthRange;
	private BodyShape bodyShape;
	private Name name;
	
	private Check check;
	
	public String getIdentifier() {
		return identifier;
	}

	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	public Fangs getFangs() {
		return fangs;
	}

	public void setFangs(Fangs fangs) {
		this.fangs = fangs;
	}

	public Boolean getPit() {
		return pit;
	}

	public void setPit(Boolean pit) {
		this.pit = pit;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public Pattern getPattern() {
		return pattern;
	}

	public void setPattern(Pattern pattern) {
		this.pattern = pattern;
	}

	public Scales getScales() {
		return scales;
	}

	public void setScales(Scales scales) {
		this.scales = scales;
	}

	public List<Feature> getFeature() {
		return features;
	}
	
	public void addFeature(Feature feature) {
		if (features == null) {
			features = new ArrayList<Feature>();
		}
		
		if (!features.contains(feature)) {
			features.add(feature);
		}
	}

	public Double getLength() {
		return length;
	}

	public void setLength(Double length) {
		this.length = length;
	}

	public Double getCircumference() {
		return circumference;
	}

	public void setCircumference(Double circumference) {
		this.circumference = circumference;
	}

	public LengthRange getLengthRange() {
		return lengthRange;
	}

	public void setLengthRange(LengthRange lengthRange) {
		this.lengthRange = lengthRange;
	}

	public BodyShape getBodyShape() {
		return bodyShape;
	}

	public void setBodyShape(BodyShape bodyShape) {
		this.bodyShape = bodyShape;
	}

	public Name getName() {
		return name;
	}

	public void setName(Name name) {
		this.name = name;
	}

	public Check getCheck() {
		return check;
	}

	public void setCheck(Check check) {
		this.check = check;
	}

	public String toString() {
		String result = "* " + identifier;
			
		if (name != null) {
			result += ": " + name.toString();
		} else {
			result += ": UNKNOWN NAME";
		}
		
		if (fangs != null) {
			result += "\n   - Fangs: " + fangs.toString();
		}
		
		if (lengthRange != null) {
			result += "\n   - Length Range: " + lengthRange.toString();
		} else {
			result += "\n   - Length: " + length + " feet";
		}

		if (pit != null) {
			if (pit) {
				result += "\n   - Has pits";
			} else {
				result += "\n   - NO-pits";
			}
		}		
		
		if (bodyShape != null) {
			result += "\n   - Body Shape: " + bodyShape.toString();
		} else {
			result += "\n   - Circumference: " + circumference + " feet";
		}		
		
		if (scales != null) {
			result += "\n   - Scales: " + scales.toString();
		}
		
		result += "\n   - Peculiar features: ";
		
		if (features != null && !features.isEmpty()) {
			for (Feature feature : features) {
				result += feature.toString() + ", ";
			}
		} else {
			result += "None";
		}
		
		if (color != null) {
			result += "\n   - Base color: " + color.toString();
		}
		
		if (pattern != null) {
			result += "\n   - Pattern: " + pattern.toString();
		} else {
			result += " (uniform color)";
		}
		
		return result;
	}}